@@ -0,0 +1,5 @@ |
||
1 |
+#!/bin/bash |
|
2 |
+# This is a simple build script and will be executed on your CI system if |
|
3 |
+# available. Otherwise it will execute while your application is stopped |
|
4 |
+# before the deploy step. This script gets executed directly, so it |
|
5 |
+# could be python, php, ruby, etc. |
@@ -0,0 +1,9 @@ |
||
1 |
+#!/bin/bash |
|
2 |
+# This deploy hook gets executed after dependencies are resolved and the |
|
3 |
+# build hook has been run but before the application has been started back |
|
4 |
+# up again. This script gets executed directly, so it could be python, php, |
|
5 |
+# ruby, etc. |
|
6 |
+ |
|
7 |
+pushd ${OPENSHIFT_REPO_DIR} > /dev/null |
|
8 |
+RAILS_ENV="production" bundle exec rake db:migrate |
|
9 |
+popd > /dev/null |
@@ -0,0 +1,4 @@ |
||
1 |
+#!/bin/bash |
|
2 |
+# This is a simple post deploy hook executed after your application |
|
3 |
+# is deployed and started. This script gets executed directly, so |
|
4 |
+# it could be python, php, ruby, etc. |
@@ -0,0 +1,15 @@ |
||
1 |
+#!/bin/bash |
|
2 |
+ |
|
3 |
+# The pre_start_cartridge and pre_stop_cartridge hooks are *SOURCED* |
|
4 |
+# immediately before (re)starting or stopping the specified cartridge. |
|
5 |
+# They are able to make any desired environment variable changes as |
|
6 |
+# well as other adjustments to the application environment. |
|
7 |
+ |
|
8 |
+# The post_start_cartridge and post_stop_cartridge hooks are executed |
|
9 |
+# immediately after (re)starting or stopping the specified cartridge. |
|
10 |
+ |
|
11 |
+# Exercise caution when adding commands to these hooks. They can |
|
12 |
+# prevent your application from stopping cleanly or starting at all. |
|
13 |
+# Application start and stop is subject to different timeouts |
|
14 |
+# throughout the system. |
|
15 |
+ |
@@ -0,0 +1,14 @@ |
||
1 |
+#!/bin/bash |
|
2 |
+ |
|
3 |
+# The pre_start_cartridge and pre_stop_cartridge hooks are *SOURCED* |
|
4 |
+# immediately before (re)starting or stopping the specified cartridge. |
|
5 |
+# They are able to make any desired environment variable changes as |
|
6 |
+# well as other adjustments to the application environment. |
|
7 |
+ |
|
8 |
+# The post_start_cartridge and post_stop_cartridge hooks are executed |
|
9 |
+# immediately after (re)starting or stopping the specified cartridge. |
|
10 |
+ |
|
11 |
+# Exercise caution when adding commands to these hooks. They can |
|
12 |
+# prevent your application from stopping cleanly or starting at all. |
|
13 |
+# Application start and stop is subject to different timeouts |
|
14 |
+# throughout the system. |
@@ -0,0 +1,22 @@ |
||
1 |
+#!/bin/bash |
|
2 |
+# This is a simple script and will be executed on your CI system if |
|
3 |
+# available. Otherwise it will execute while your application is stopped |
|
4 |
+# before the build step. This script gets executed directly, so it |
|
5 |
+# could be python, php, ruby, etc. |
|
6 |
+ |
|
7 |
+STORED_ASSETS="${OPENSHIFT_DATA_DIR}/assets" |
|
8 |
+LIVE_ASSETS="${OPENSHIFT_REPO_DIR}/public/assets" |
|
9 |
+ |
|
10 |
+# Ensure our stored assets directory exists |
|
11 |
+if [ ! -d "${STORED_ASSETS}" ]; then |
|
12 |
+ echo " Creating permanent assets directory" |
|
13 |
+ mkdir "${STORED_ASSETS}" |
|
14 |
+fi |
|
15 |
+ |
|
16 |
+# Create symlink to stored assets unless we're uploading our own assets |
|
17 |
+if [ -d "${LIVE_ASSETS}" ]; then |
|
18 |
+ echo " WARNING: Assets included in git repository, not using stored assets" |
|
19 |
+else |
|
20 |
+ echo " Restoring stored assets" |
|
21 |
+ ln -s "${STORED_ASSETS}" "${LIVE_ASSETS}" |
|
22 |
+fi |
@@ -0,0 +1,33 @@ |
||
1 |
+#!/bin/bash |
|
2 |
+ |
|
3 |
+# The pre_start_cartridge and pre_stop_cartridge hooks are *SOURCED* |
|
4 |
+# immediately before (re)starting or stopping the specified cartridge. |
|
5 |
+# They are able to make any desired environment variable changes as |
|
6 |
+# well as other adjustments to the application environment. |
|
7 |
+ |
|
8 |
+# The post_start_cartridge and post_stop_cartridge hooks are executed |
|
9 |
+# immediately after (re)starting or stopping the specified cartridge. |
|
10 |
+ |
|
11 |
+# Exercise caution when adding commands to these hooks. They can |
|
12 |
+# prevent your application from stopping cleanly or starting at all. |
|
13 |
+# Application start and stop is subject to different timeouts |
|
14 |
+# throughout the system. |
|
15 |
+ |
|
16 |
+if [ -f ${OPENSHIFT_REPO_DIR}/.env.example ] |
|
17 |
+then |
|
18 |
+ grep = ${OPENSHIFT_REPO_DIR}/.env.example | sed -e 's/^#[^ ]//' | grep -v -e '^#' | cut -d= -f1 | \ |
|
19 |
+ while read var ; do |
|
20 |
+ eval "echo \"$var=\\\"\${$var:-\$$var}\\\"\"" |
|
21 |
+ done | grep -v -e ^= > ${OPENSHIFT_REPO_DIR}/.env |
|
22 |
+ |
|
23 |
+ chmod ugo+r ${OPENSHIFT_REPO_DIR}/.env |
|
24 |
+ source ${OPENSHIFT_REPO_DIR}/.env |
|
25 |
+else |
|
26 |
+ cat <<EOM |
|
27 |
+*** |
|
28 |
+* |
|
29 |
+* WARNING: No .env.example file found. |
|
30 |
+* |
|
31 |
+*** |
|
32 |
+EOM |
|
33 |
+fi |
@@ -0,0 +1,14 @@ |
||
1 |
+#!/bin/bash |
|
2 |
+ |
|
3 |
+# The pre_start_cartridge and pre_stop_cartridge hooks are *SOURCED* |
|
4 |
+# immediately before (re)starting or stopping the specified cartridge. |
|
5 |
+# They are able to make any desired environment variable changes as |
|
6 |
+# well as other adjustments to the application environment. |
|
7 |
+ |
|
8 |
+# The post_start_cartridge and post_stop_cartridge hooks are executed |
|
9 |
+# immediately after (re)starting or stopping the specified cartridge. |
|
10 |
+ |
|
11 |
+# Exercise caution when adding commands to these hooks. They can |
|
12 |
+# prevent your application from stopping cleanly or starting at all. |
|
13 |
+# Application start and stop is subject to different timeouts |
|
14 |
+# throughout the system. |
@@ -0,0 +1,22 @@ |
||
1 |
+Run scripts or jobs on a periodic basis |
|
2 |
+======================================= |
|
3 |
+Any scripts or jobs added to the minutely, hourly, daily, weekly or monthly |
|
4 |
+directories will be run on a scheduled basis (frequency is as indicated by the |
|
5 |
+name of the directory) using run-parts. |
|
6 |
+ |
|
7 |
+run-parts ignores any files that are hidden or dotfiles (.*) or backup |
|
8 |
+files (*~ or *,) or named *.{rpmsave,rpmorig,rpmnew,swp,cfsaved} |
|
9 |
+ |
|
10 |
+The presence of two specially named files jobs.deny and jobs.allow controls |
|
11 |
+how run-parts executes your scripts/jobs. |
|
12 |
+ jobs.deny ===> Prevents specific scripts or jobs from being executed. |
|
13 |
+ jobs.allow ===> Only execute the named scripts or jobs (all other/non-named |
|
14 |
+ scripts that exist in this directory are ignored). |
|
15 |
+ |
|
16 |
+The principles of jobs.deny and jobs.allow are the same as those of cron.deny |
|
17 |
+and cron.allow and are described in detail at: |
|
18 |
+ http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Automating_System_Tasks.html#s2-autotasks-cron-access |
|
19 |
+ |
|
20 |
+See: man crontab or above link for more details and see the the weekly/ |
|
21 |
+ directory for an example. |
|
22 |
+ |
@@ -0,0 +1,16 @@ |
||
1 |
+Run scripts or jobs on a weekly basis |
|
2 |
+===================================== |
|
3 |
+Any scripts or jobs added to this directory will be run on a scheduled basis |
|
4 |
+(weekly) using run-parts. |
|
5 |
+ |
|
6 |
+run-parts ignores any files that are hidden or dotfiles (.*) or backup |
|
7 |
+files (*~ or *,) or named *.{rpmsave,rpmorig,rpmnew,swp,cfsaved} and handles |
|
8 |
+the files named jobs.deny and jobs.allow specially. |
|
9 |
+ |
|
10 |
+In this specific example, the chronograph script is the only script or job file |
|
11 |
+executed on a weekly basis (due to white-listing it in jobs.allow). And the |
|
12 |
+README and chrono.dat file are ignored either as a result of being black-listed |
|
13 |
+in jobs.deny or because they are NOT white-listed in the jobs.allow file. |
|
14 |
+ |
|
15 |
+For more details, please see ../README.cron file. |
|
16 |
+ |
@@ -0,0 +1 @@ |
||
1 |
+Time And Relative D...n In Execution (Open)Shift! |
@@ -0,0 +1,3 @@ |
||
1 |
+#!/bin/bash |
|
2 |
+ |
|
3 |
+echo "`date`: `cat $(dirname \"$0\")/chrono.dat`" |
@@ -0,0 +1,12 @@ |
||
1 |
+# |
|
2 |
+# Script or job files listed in here (one entry per line) will be |
|
3 |
+# executed on a weekly-basis. |
|
4 |
+# |
|
5 |
+# Example: The chronograph script will be executed weekly but the README |
|
6 |
+# and chrono.dat files in this directory will be ignored. |
|
7 |
+# |
|
8 |
+# The README file is actually ignored due to the entry in the |
|
9 |
+# jobs.deny which is checked before jobs.allow (this file). |
|
10 |
+# |
|
11 |
+chronograph |
|
12 |
+ |
@@ -0,0 +1,7 @@ |
||
1 |
+# |
|
2 |
+# Any script or job files listed in here (one entry per line) will NOT be |
|
3 |
+# executed (read as ignored by run-parts). |
|
4 |
+# |
|
5 |
+ |
|
6 |
+README |
|
7 |
+ |
@@ -0,0 +1,8 @@ |
||
1 |
+Markers |
|
2 |
+=========== |
|
3 |
+ |
|
4 |
+Adding marker files to this directory will have the following effects: |
|
5 |
+ |
|
6 |
+force_clean_build - Previous output from bundle install --deployment will be |
|
7 |
+ removed and all gems will be reinstalled according to the current |
|
8 |
+ Gemfile/Gemfile.lock. |